import {useState} from "react";

/**
 * table - form 的编辑弹窗控制
 */
export default function useEditFormModal (){
    const [visible,setVisible] = useState<boolean>(false);
    const [editId,setEditId] = useState<string>("");
    const [editTitle,seteEitTitle] = useState<string>("");
    const show = (title:string, id?:string,) => {
        setVisible(true);
        setEditId(id|| "");
        seteEitTitle(title );
        return null;
    };
    const reset = ()=>{
        setVisible(false);
        setEditId("");
        seteEitTitle( "");
    };
    return {visible, editId, editTitle,show,reset};
}
